//
//  CLCollectionViewLayout.h
//  HanGoodsMall
//
//  Created by zhuyuelong on 17/1/12.
//  Copyright © 2017年 zhuyuelong. All rights reserved.
//

#import <UIKit/UIKit.h>
UIKIT_EXTERN NSString *const UICollectionElementKindSectionHeader;
UIKIT_EXTERN NSString *const UICollectionElementKindSectionFooter;

@class CLCollectionViewLayout;

@protocol CLFlowLayoutDelegate <NSObject>

@required
@required
//item heigh
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(CLCollectionViewLayout *)collectionViewLayout heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath*)indexPath;

@optional
//section header
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(CLCollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
//section footer
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(CLCollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section;

-(CGFloat)flowLayoutColumnCount:(CLCollectionViewLayout *)layout;



@end

@interface CLCollectionViewLayout : UICollectionViewLayout

@property(nonatomic, assign)UIEdgeInsets sectionInset; //sectionInset
@property(nonatomic, assign)CGFloat lineSpacing;  //line space
@property(nonatomic, assign)CGFloat itemSpacing; //item space
@property(nonatomic, assign)CGFloat colCount; //column count

@property (nonatomic,weak) id<CLFlowLayoutDelegate>delegate;

@end
